﻿<%@ Page Title="::สมัครสมาชิก::" Language="C#" MasterPageFile="../masterpage/HomeSite.Master" AutoEventWireup="true" CodeBehind="RegisterForm.aspx.cs" Inherits="RegisterForm" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../stylesheet/cssform.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
    function CheckUserID() {
        if (document.getElementById('<%=txtUserID.ClientID %>').value == '') {
            alert('กรุณาระบุชื่อสมาชิก');
            document.getElementById('<%=txtUserID.ClientID %>').focus();
            return false;
        }
        var regExUserID = /^(?!.*[^A-Za-z0-9]).{6,12}$/;
        var strUserID = document.getElementById('<%=txtUserID.ClientID %>').value;
        if (!strUserID.match(regExUserID)) {
            alert('ชื่อสมาชิกต้องมีความยาว 6-12 ตัวอักษร');
            document.getElementById('<%=txtUserID.ClientID %>').select();
            document.getElementById('<%=txtUserID.ClientID %>').focus();
            return false;
        }
    }
    function Confirm() {             
        if (document.getElementById('<%=txtUserID.ClientID %>').value == '') {
            alert('กรุณาระบุชื่อสมาชิก');
            document.getElementById('<%=txtUserID.ClientID %>').focus();
            return false;
        }
        var regExUserID = /^(?!.*[^A-Za-z0-9]).{6,12}$/;
        var strUserID = document.getElementById('<%=txtUserID.ClientID %>').value;
        if (!strUserID.match(regExUserID)) {
            alert('ชื่อสมาชิกต้องมีความยาว 6-12 ตัวอักษร');
            document.getElementById('<%=txtUserID.ClientID %>').select();
            document.getElementById('<%=txtUserID.ClientID %>').focus();
            return false;
        }
        if (document.getElementById('<%=txtEmail.ClientID %>').value == '') {
            alert('กรุณาระบุอีเมล์');
            document.getElementById('<%=txtEmail.ClientID %>').focus();
            return false;
        }
        var regExEmail = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
        if (!regExEmail.test(document.getElementById('<%=txtEmail.ClientID %>').value)) {
            alert('กรุณาระบุอีเมลล์ให้ถูกต้อง ตามรูปแบบของอีเมลล์');
            document.getElementById('<%=txtEmail.ClientID %>').select();
            document.getElementById('<%=txtEmail.ClientID %>').focus();
            return false;
        }
        if (document.getElementById('<%=txtPassword.ClientID %>').value == '') {
            alert('กรุณาระบุรหัสผ่าน');
            document.getElementById('<%=txtPassword.ClientID %>').focus();
            return false;
        }
        var regExPassword = /^(?!.*[^A-Za-z0-9]).{6,12}$/;
        var strPassword = document.getElementById('<%=txtPassword.ClientID %>').value;
        if (!strPassword.match(regExPassword)) {
            alert('รหัสผ่านต้องมีความยาว 6-12 ตัวอักษร');
            document.getElementById('<%=txtPassword.ClientID %>').select();
            document.getElementById('<%=txtPassword.ClientID %>').focus();
            return false;
        }
        if (document.getElementById('<%=txtName.ClientID %>').value == '') {
            alert('กรุณาระบุชื่อ');
            document.getElementById('<%=txtName.ClientID %>').focus();
            return false;
        }
        if (document.getElementById('<%=txtSurname.ClientID %>').value == '') {
            alert('กรุณาระบุนามสกุล');
            document.getElementById('<%=txtSurname.ClientID %>').focus();
            return false;
        }
        if (document.getElementById('<%=txtShopName.ClientID %>').value == '') {
            alert('กรุณาระบุชื่อร้าน');
            document.getElementById('<%=txtShopName.ClientID %>').focus();
            return false;
        }
        if (document.getElementById('<%=txtAddress.ClientID %>').value == '') {
            alert('กรุณาระบุที่อยู่');
            document.getElementById('<%=txtAddress.ClientID %>').focus();
            return false;
        }
        if (document.getElementById('<%=txtLatitude.ClientID %>').value == '') {
            alert('กรุณาระบุLatitude');
            document.getElementById('<%=txtLatitude.ClientID %>').focus();
            return false;
        }
        if (document.getElementById('<%=txtLongitude.ClientID %>').value == '') {
            alert('กรุณาระบุLongitude');
            document.getElementById('<%=txtLongitude.ClientID %>').focus();
            return false;
        }
        if (document.getElementById('<%=txtPassword.ClientID %>').value != document.getElementById('<%=txtConfirmPassword.ClientID %>').value) {
            alert('รหัสผ่านไม่ตรงกัน');
            document.getElementById('<%=txtConfirmPassword.ClientID %>').select();
            document.getElementById('<%=txtConfirmPassword.ClientID %>').focus();
            return false;
        }
        if (document.getElementById('<%=ddlPackage.ClientID %>').value == 0) {
            alert('กรุณาระบุPackage');
            document.getElementById('<%=ddlPackage.ClientID %>').focus();
            return false;
        }
        if (document.getElementById('<%=ddlShopType.ClientID %>').value == 0) {
            alert('กรุณาระบุประเภทร้าน');
            document.getElementById('<%=ddlShopType.ClientID %>').focus();
            return false;
        }
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
 <table border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td align="left" class="cssformhead">
                ข้อมูลสมาชิก (Member Information)</td>
        </tr>
        <tr>
            <td align="left" class="cssformhead">
                รหัสผู้ใช้ (User Login)
            </td>
        </tr>
        <tr>
            <td align="left" class="cssform">
                รหัสผู้ใช้ :
            </td>
            <td align="left" valign="top">
                <asp:TextBox ID="txtUserID" runat="server"></asp:TextBox>
                &nbsp;* <asp:Button ID="btnCheckID" runat="server" Text="ตรวจสอบรหัสผู้ใช้" 
                    onclick="btnCheckID_Click" />
                </td>
            <td style="width:140px">
                <asp:Label ID="lblCheckID" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td align="left" class="cssform">
            อีเมล์ :
            </td>
            <td align="left" valign="top">
                <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
            &nbsp;*</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td align="left" class="cssform">
            รหัสผ่าน :
            </td>
            <td align="left" valign="top">
                <asp:TextBox ID="txtPassword" TextMode="Password" runat="server"></asp:TextBox>
            &nbsp;*&nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td align="left" class="cssform">
                ยืนยันรหัสผ่าน :</td>
            <td align="left" valign="top">
                <asp:TextBox ID="txtConfirmPassword" TextMode="Password" runat="server"></asp:TextBox>
                &nbsp;*</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td align="left" class="cssformhead">
            ข้อมูลส่วนตัว (Personal Information)
            </td>
        </tr>
        <tr>
            <td align="left" class="cssform">
                ชื่อ :
            </td>
            <td align="left" valign="top">
                <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                &nbsp;*</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td align="left" class="cssform">
                นามสกุล :</td>
            <td align="left" valign="top">
                <asp:TextBox ID="txtSurname" runat="server"></asp:TextBox>
                &nbsp;*</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td align="left" class="cssform">
            โทรศัพท์มือถือ :
            </td>
            <td align="left" valign="top">
                <asp:TextBox ID="txtTelNo" runat="server"></asp:TextBox>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td align="left" class="cssformhead">
            ข้อมูลร้านค้า (Shop Information)
            </td>
        </tr>
        <tr>
            <td align="left" class="cssform">
            ชื่อร้านค้า :
            </td>
            <td align="left" valign="top">
                <asp:TextBox ID="txtShopName" runat="server"></asp:TextBox>
                &nbsp;*</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td align="left" valign="top" class="cssform">
            ที่อยู่ :
            </td>
            <td align="left" valign="top">
                <asp:TextBox ID="txtAddress" runat="server" TextMode="MultiLine" Height="65px" Width="255px"></asp:TextBox>
                &nbsp;*</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td align="left" class="cssform">
            Latitude :
            </td>
            <td align="left" valign="top">
                <asp:TextBox ID="txtLatitude" runat="server"></asp:TextBox>
    &nbsp;*
    </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td align="left" class="cssform">
               Longitude :
            </td>
            <td align="left" valign="top">
                <asp:TextBox ID="txtLongitude" runat="server"></asp:TextBox>
    &nbsp;*</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td align="left" class="cssform">
                รายละเอียดร้านค้า :
            </td>
            <td align="left" valign="top">
                <asp:TextBox ID="txtShopDetail" runat="server"  TextMode="MultiLine" 
                    Height="71px" Width="250px"></asp:TextBox>
            </td>
            <td>
                &nbsp;</td>
        </tr>
         <tr>
            <td align="left" class="cssform">
            โลโก้ร้านค้า :
            </td>
            <td align="left" valign="top">
            <asp:FileUpload ID="flUploadShopLogo" runat="server" /></td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td align="left" class="cssform">
            Package :
            </td>   
            <td align="left" valign="top">
                <asp:DropDownList ID="ddlPackage" runat="server"></asp:DropDownList>&nbsp;*
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td align="left" class="cssform">
            ประเภทร้านค้า :
            </td>   
            <td align="left" valign="top">
                <asp:DropDownList ID="ddlShopType" runat="server"></asp:DropDownList>&nbsp;*
            </td>
            <td>
                &nbsp;</td>
        </tr>
         <tr>
            <td align="left" class="cssform">
            รูปภาพร้านค้า :    
            </td>
            <td align="left" valign="top">
                <asp:FileUpload ID="flUploadShopImage" runat="server" />
            </td>
             <td>
                &nbsp;</td>
        </tr>
         <tr>
            <td align="center" class="cssmessage" colspan="3">
                <asp:Label ID="lblMessage" runat="server"></asp:Label>                
            </td>
        </tr>
        <tr>
            <td class="cssformbutton" colspan="3">
            <asp:Button ID="btnRegister" runat="server" Text="ลงทะเบียน" 
                    onclick="btnRegister_Click" />&nbsp;<asp:Button ID="btnReset" 
                    runat="server" Text="Reset" onclick="btnReset_Click" />

            </td>
        </tr>
    </table>
</td>
</tr>
</table>
   
</asp:Content>
